/**
 * User.js
 *
 * @description :: TODO: You might write a short summary of how this model works and what it represents here.
 * @docs        :: http://sailsjs.org/documentation/concepts/models-and-orm/models
 */

var uuid = require("node-uuid");

module.exports = {

  attributes: {
		id: {
			type: "integer",
			primaryKey: true,
			autoIncrement: true
		},

		username: {
			type: "string",
			unique: true
		},

		salt: {
			type: "string"
		},

		password: {
			type: "string"
		},

		token: {
			type: "string",
			defaultsTo: function(){
				return uuid.v4()
			}
		},

		address: {
			collection: "Address",
			via: "owner"
		}

  }
};

